<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>{$meta_title}-狂雨小说CMS</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <link rel="stylesheet" href="__ADMIN__/css/admin.css">
    </head>
    <body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">
                        分类绑定
                    </div>
                    <div class="layui-card-body">
                        <ul class="layui-class-tree">
                            {volist name="list_category" id="cat"}
                            <li>
                                <a href="{:url('list',['url'=>$Request.param.url,'sid'=>$Request.param.sid,'type'=>$Request.param.type,'cid'=>$cat['id']])}">{$cat['title']}</a>
                                {neq name="cat['branch']" value="1"}
                                    {notempty name="bind_type[$Request.param.sid][$cat['id']]"}
                                        <button class="layui-btn layui-btn-xs" bind="union_type" bind-id="{$cat['id']}" category-id="{$bind_type[$Request.param.sid][$cat['id']]|default=''}"><i class="layui-icon layui-icon-ok"></i> 已绑定</button>
                                    {else /}
                                        <button class="layui-btn layui-btn-xs layui-btn-danger" bind="union_type" bind-id="{$cat['id']}"><i class="layui-icon layui-icon-close"></i> 未绑定</button>
                                    {/notempty}
                                {/neq}
                                {eq name="cat['branch']" value="1"}
                                <ul>
                                    {volist name="cat['subor']" id="sub"}
                                    <li>
                                        <a href="{:url('list',['url'=>$Request.param.url,'sid'=>$Request.param.sid,'type'=>$Request.param.type,'cid'=>$sub['id']])}">{$sub['title']}</a>
                                        {neq name="sub['branch']" value="1"}
                                            {notempty name="bind_type[$Request.param.sid][$sub['id']]"}
                                                <button class="layui-btn layui-btn-xs" bind="union_type" bind-id="{$sub['id']}" category-id="{$bind_type[$Request.param.sid][$sub['id']]|default=''}"><i class="layui-icon layui-icon-ok"></i> 已绑定</button>
                                            {else /}
                                                <button class="layui-btn layui-btn-xs layui-btn-danger" bind="union_type" bind-id="{$sub['id']}"><i class="layui-icon layui-icon-close"></i> 未绑定</button>
                                            {/notempty}
                                        {/neq}
                                        {eq name="sub['branch']" value="1"}
                                        <ul>
                                            {volist name="sub['subor']" id="vo"}
                                            <li>
                                                <a href="{:url('list',['url'=>$Request.param.url,'type'=>$Request.param.type,'cid'=>$vo['id']])}">{$vo['title']}</a>
                                                {notempty name="bind_type[$Request.param.sid][$vo['id']]"}
                                                    <button class="layui-btn layui-btn-xs" bind="union_type" bind-id="{$vo['id']}" category-id="{$bind_type[$Request.param.sid][$vo['id']]|default=''}"><i class="layui-icon layui-icon-ok"></i> 已绑定</button>
                                                {else /}
                                                    <button class="layui-btn layui-btn-xs layui-btn-danger" bind="union_type" bind-id="{$vo['id']}"><i class="layui-icon layui-icon-close"></i> 未绑定</button>
                                                {/notempty}
                                            </li>
                                            {/volist}
                                        </ul>
                                        {/eq}
                                    </li>
                                    {/volist}
                                </ul>
                                {/eq}
                            </li>
                            {/volist}
                        </ul>
                    </div>
                </div>
                <form class="layui-form" action="{:url('collect',['sid'=>$Request.param.sid,'type'=>$Request.param.type,'url'=>$Request.param.url,'model'=>'id'])}" method="post">
                    <div class="layui-card">
                        <div class="layui-card-body">
                            <div style="padding-bottom: 10px;display: inline-block;">
                                <button class="layui-btn" lay-submit lay-filter="collect" type="submit"><i class="layui-icon layui-icon-senior"></i> 采集</button>
                                <button class="layui-btn" type="button" onclick="admin_show('采集当日','{:url('collect',['sid'=>$Request.param.sid,'type'=>$Request.param.type,'url'=>$Request.param.url,'model'=>'today'])}',0,0,1,1)"><i class="layui-icon layui-icon-senior"></i> 采集当日</button>
                                {notempty name="Request.param.cid"}
                                <button class="layui-btn" type="button" onclick="admin_show('采集当前分类','{:url('collect',['cid'=>$Request.param.cid,'sid'=>$Request.param.sid,'type'=>$Request.param.type,'url'=>$Request.param.url,'model'=>'all'])}',0,0,1,1)"><i class="layui-icon layui-icon-senior"></i> 采集当前分类</button>
                                {/notempty}
                                <button class="layui-btn" type="button" onclick="admin_show('采集全部','{:url('collect',['sid'=>$Request.param.sid,'type'=>$Request.param.type,'url'=>$Request.param.url,'model'=>'all'])}',0,0,1,1)"><i class="layui-icon layui-icon-senior"></i> 采集全部</button>
                            </div>
                            <div class="layui-inline rf">
                                <label class="layui-form-label">查询</label>
                                <div class="layui-input-inline w300">
                                    <div class="input-group">
                                        <input type="text" style="width:240px;" name="keyword" placeholder="请输入" class="layui-input">
                                        <button id="collect_search" class="layui-btn layuiadmin-btn-admin" url="{:url('lists',['sid'=>$Request.param.sid,'type'=>$Request.param.type,'url'=>$Request.param.url])}" type="button"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i></button>
                                    </div>
                                </div>
                            </div>
                            <table class="layui-table">
                                <colgroup>
                                    <col width="50">
                                    <col width="300">
                                    <col width="100">
                                    <col width="110">
                                    <col>
                                    <col width="150">
                                    <col width="150">
                                </colgroup>
                                <thead>
                                    <tr>
                                        <th><input name="layTableCheckbox" lay-filter="layTableAllChoose" type="checkbox" lay-skin="primary"></th>
                                        <th>书名</th>
                                        <th>分类</th>
                                        <th>作者</th>
                                        <th>最新章节</th>
                                        <th>更新时间</th>
                                        <th><div align="center">操作</div></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {notempty name="list"}
                                    {volist name="list" id="vo"}
                                    <tr>
                                        <td><input name="id[]" type="checkbox" lay-skin="primary" value="{$vo.id}"></td>
                                        <td>{$vo.title|default=''}</td>
                                        <td>{$vo.ctitle|default=''}</td>
                                        <td>{$vo.author|default=''}</td>
                                        <td>{$vo.chapter_title|default=''}</td>
                                        <td>{$vo['update_time']|default=''|time_format="Y-m-d H:i"}</td>
                                        <td align="center">
                                            <a onclick="admin_show('采集','{:url('collect',['sid'=>$Request.param.sid,'type'=>$Request.param.type,'url'=>$Request.param.url,'model'=>'id','id'=>$vo['id']])}',0,0,1)" class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:;"><i class="layui-icon layui-icon-edit"></i>采集</a> 
                                        </td>
                                    </tr>
                                    {/volist}
                                    {else/}
                                        <td colspan="6"> aOh! 暂时还没有内容! </td>
                                    {/notempty}
                                </tbody>
                            </table>
                            <div class="page">
                                {$page|raw}
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div id="bind_type" class="layui-hide">
        <form class="layui-form" action="{:url('bind_type')}" lay-filter="bind_type">
            <div class="layui-form-item" style="margin:5px">
                <div class="layui-input-inline">
                    <select name="category">
                        {volist name="category" id="vo"}
                            <option value="{$vo['id']}">{$vo.html}{$vo.title}</option>
                        {/volist}
                        <option value="">取消绑定</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width: 65px;">
                    <input name="sid" type="hidden" value="{$Request.param.sid}" />
                    <input name="id" type="hidden" value="" />
                    <button type="reset" class="layui-btn layui-btn-normal" lay-submit lay-filter="ajax" type="submit" callback="removebind(that)">提交</button>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="__STATIC__/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/admin.js"></script>
    <script type="text/javascript">
        {present name="param_data"}
            layui.use('layer', function(){
                layui.layer.confirm('是否接着上次接续采集？', {
                  title:'断点续采',
                  btn: ['继续采集','不需要'] //按钮
                }, function(index){
                    admin_show('断点续采','{:url('collect',$param_data)}',0,0,1,1);
                    layui.layer.close(index);
                }, function(index, layero){
                    $.ajax({
                        url: '{:url('del_collect_log',['id'=>$param_data['sid']])}',
                        type: 'get',
                        dataType: 'json'
                    })
                    .done(function() {
                        layui.layer.close(index);
                    })
                });
            });
        {/present}
    </script>
    </body>
</html>